import request from '@/utils/request';

//创建部门
export function createDep(data) {
    return request({
        url: `/section/`,
        method: 'post',
        data: data
    })
}

//修改部门
export function updataDep(data,id) {
    return request({
        url: `/section/${id}/`,
        method: 'put',
        data:data
    })
}

//查看部门列表  parent为父集部门id，没有则不传，查的就是顶层
export function queryDepList(data) {
    return request({
        url: `/section/?parent=${data.parent}&size=${data.page.pageSize}&page=${data.page.pageNum}`,
        method: 'get',
        timeout: 3000,
    })
}

//查看部门列表-不带分页版  parent为父集部门id，没有则不传，查的就是顶层
export function queryParentDepList(parentId) {
    return request({
        url: `/section/all/`,
        method: 'get',
        // timeout: 3000,
        params:{
            parent:parentId
        }
    })
}

// 查看部门详情
export function queryDepInfo(id) {
    return request({
        url: `/section/${id}`,
        method: 'get',
    })
}

//删除部门
export function delDep(id) {
    return request({
        url: `/section/${id}/`,
        method: 'delete',
    })
}
